/*
 * tInit.c
 *
 *  Created on: 2019年7月23日
 *      Author: cludu
 */

#include "tInit.h"
#include "tTask.h"



void DoNop(void)
{
    __no_operation();
}



uint8_t MaskTask0(uint8_t prio)
{
    uint8_t SubPrio = 0;
    while(tTaskSub[prio])
    {
        SubPrio = TaskPrioTable[tTaskSub[prio]];
        switch(SubPrio)
        {
            case 0: Task0Sub0(); break;
            case 1: Task0Sub1(); break;
            case 2: Task0Sub2(); break;
            case 3: Task0Sub3(); break;
            case 4: Task0Sub4(); break;
            case 5: Task0Sub5(); break;
            case 6: Task0Sub6(); break;
            case 7: Task0Sub7(); break;
            default:break;
        }
        if(clear_task(prio, SubPrio) == 1)
        {
            return 1;
        }
    }
    return 0;
}




uint8_t MaskTask1(uint8_t prio)
{
    uint8_t SubPrio = 0;
    while(tTaskSub[prio])
    {
        SubPrio = TaskPrioTable[tTaskSub[prio]];
        switch(SubPrio)
        {
            case 0: Task1Sub0(); break;
            case 1: Task1Sub1(); break;
            case 2: Task1Sub2(); break;
            case 3: Task1Sub3(); break;
            case 4: Task1Sub4(); break;
            case 5: Task1Sub5(); break;
            case 6: Task1Sub6(); break;
            case 7: Task1Sub7(); break;
        default:break;
        }
        if(clear_task(prio, SubPrio) == 1)
        {
            return 1;
        }
    }
    return 0;
}




uint8_t MaskTask2(uint8_t prio)
{
    uint8_t SubPrio = 0;
    while(tTaskSub[prio])
    {
        SubPrio = TaskPrioTable[tTaskSub[prio]];
        switch(SubPrio)
        {
            case 0: Task2Sub0(); break;
            case 1: Task2Sub1(); break;
            case 2: Task2Sub2(); break;
            case 3: Task2Sub3(); break;
            case 4: Task2Sub4(); break;
            case 5: Task2Sub5(); break;
            case 6: Task2Sub6(); break;
            case 7: Task2Sub7(); break;
           default:break;
        }
        if(clear_task(prio, SubPrio) == 1)
        {
            return 1;
        }
    }
    return 0;
}
uint8_t MaskTask3(uint8_t prio)
{
    uint8_t SubPrio = 0;
    while(tTaskSub[prio])
    {
        SubPrio = TaskPrioTable[tTaskSub[prio]];
        switch(SubPrio)
        {
            case 0: Task3Sub0(); break;
            case 1: Task3Sub1(); break;
            case 2: Task3Sub2(); break;
            case 3: Task3Sub3(); break;
            case 4: Task3Sub4(); break;
            case 5: Task3Sub5(); break;
            case 6: Task3Sub6(); break;
            case 7: Task3Sub7(); break;
            default:break;
        }
        if(clear_task(prio, SubPrio) == 1)
        {
            return 1;
        }
    }
    return 0;
}




uint8_t MaskTask4(uint8_t prio)
{
    uint8_t SubPrio = 0;
    while(tTaskSub[prio])
    {
        SubPrio = TaskPrioTable[tTaskSub[prio]];
        switch(SubPrio)
        {
            case 0: Task4Sub0(); break;
            case 1: Task4Sub1(); break;
            case 2: Task4Sub2(); break;
            case 3: Task4Sub3(); break;
            case 4: Task4Sub4(); break;
            case 5: Task4Sub5(); break;
            case 6: Task4Sub6(); break;
            case 7: Task4Sub7(); break;
            default:break;
        }
        if(clear_task(prio, SubPrio) == 1)
        {
            return 1;
        }
    }
    return 0;
}




uint8_t MaskTask5(uint8_t prio)
{
    uint8_t SubPrio = 0;
    while(tTaskSub[prio])
    {
        SubPrio = TaskPrioTable[tTaskSub[prio]];
        switch(SubPrio)
        {
            case 0: Task5Sub0(); break;
            case 1: Task5Sub1(); break;
            case 2: Task5Sub2(); break;
            case 3: Task5Sub3(); break;
            case 4: Task5Sub4(); break;
            case 5: Task5Sub5(); break;
            case 6: Task5Sub6(); break;
            case 7: Task5Sub7(); break;
            default:break;
        }
        if(clear_task(prio, SubPrio) == 1)
        {
            return 1;
        }
    }
    return 0;
}




uint8_t MaskTask6(uint8_t prio)
{
    uint8_t SubPrio = 0;
    while(tTaskSub[prio])
    {
        SubPrio = TaskPrioTable[tTaskSub[prio]];
        switch(SubPrio)
        {
            case 0: Task6Sub0(); break;
            case 1: Task6Sub1(); break;
            case 2: Task6Sub2(); break;
            case 3: Task6Sub3(); break;
            case 4: Task6Sub4(); break;
            case 5: Task6Sub5(); break;
            case 6: Task6Sub6(); break;
            case 7: Task6Sub7(); break;
            default:break;
        }
        if(clear_task(prio, SubPrio) == 1)
        {
            return 1;
        }
    }
    return 0;
}




uint8_t MaskTask7(uint8_t prio)
{
    uint8_t SubPrio = 0;
    while(tTaskSub[prio])
    {
        SubPrio = TaskPrioTable[tTaskSub[prio]];
        switch(SubPrio)
        {
            case 0: Task7Sub0(); break;
            case 1: Task7Sub1(); break;
            case 2: Task7Sub2(); break;
            case 3: Task7Sub3(); break;
            case 4: Task7Sub4(); break;
            case 5: Task7Sub5(); break;
            case 6: Task7Sub6(); break;
            case 7: Task7Sub7(); break;
            default:break;
        }
        if(clear_task(prio, SubPrio) == 1)
        {
            return 1;
        }
    }
    return 0;
}
